import { inject } from 'vue'

export default function useSearch() {
  const search_form = inject('search_form')

  const search = (params) => {
    search_form = Object.assign(search_form, params)
    console.log('search---', search_form)
    if (params.parent) {
      data.value = [
        { id: 1, text: 'p1' },
        { id: 2, text: 'p2' },
        { id: 3, text: 'p3' },
      ]
    } else {
      data.value = [
        { id: 1, text: 'c1' },
        { id: 2, text: 'c2' },
        { id: 3, text: 'c3' },
      ]
    }
  }

  return {
    search
  }
}